<!-- BEGIN PAGE HEADER-->
<!--https://github.com/khan4019/tree-grid-directive-->
<h3 class="page-title">
    菜单管理
    <small></small>
</h3>
<!-- END PAGE HEADER-->
<!-- BEGIN MAIN CONTENT -->
<div class="table" ng-show="!edit">
    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                菜单列表
                <button class="btn btn-success" ng-click="addMenu()"><i class="fa fa-plus"></i> 新增 </button>
                <button class="btn btn-default" onclick="$('#menu_table').treetable('expandAll');">全部展开</button>
                <button class="btn btn-default" onclick="$('#menu_table').treetable('collapseAll');">全部折叠</button>
            </div>
        </div>
        <div class="portlet-body">
            <table id="menu_table" class="table table-striped table-bordered table-advance table-hover">
                <thead>
                <tr>
                    <th>菜单名称</th>
                    <th>url</th>
                    <th>Ctrl名称</th>
                    <th>Ctrl路径</th>
                    <th>模板路径</th>
                    <th>状态</th>
                    <th width="140px">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="menu in menus" data-tt-id="{{menu.menuId}}" data-tt-parent-id='{{menu.parentMenuId}}' on-finish-render-filters>
                    <td>{{menu.menuName}}</td>
                    <td>{{menu.menuUrl}}</td>
                    <td>{{menu.ctrlName}}</td>
                    <td>{{menu.ctrlPath}}</td>
                    <td>{{menu.templateUrl}}</td>
                    <td>{{menu.menuState | code : 'menustate'}}</td>
                    <td>
                        <button class="btn btn-xs btn-edit" ng-click="editMenu(menu)"><i class="fa fa-edit"></i> 编辑</button>
                        <button class="btn btn-xs btn-delete" ng-click="deleteMenu(menu)"><i class="fa fa-trash-o"></i> 删除</button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

<div class="portlet light bordered edit" ng-show="edit">
    <div class="portlet-title">
        <div class="caption">
            <i class="icon-equalizer font-red-sunglo"></i>
            <span class="caption-subject font-red-sunglo bold uppercase">菜单编辑</span>
        </div>
        <div class="actions">
            <a class="btn btn-circle btn-icon-only btn-default" href="javascript:;" ng-click="cancel();">
                <i class="icon-action-undo"></i>
            </a>
        </div>
    </div>
    <div class="portlet-body form">
        <!-- BEGIN FORM-->
        <form action="#" class="form-horizontal w5c-form" w5c-form-validate novalidate name="validateForm">
            <div class="form-body">
                <div class="form-group">
                    <label class="col-md-3 control-label">菜单名称</label>

                    <div class="col-md-4">
                        <input type="text" class="form-control" name="menuName" required ng-model="menu.menuName">
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-md-3 control-label">上级菜单</label>

                    <div class="col-md-4">
                        <div ed-combotree ed-multiple="false" ed-key="parentMenuId,menuId,menuName" ed-data="menus2"
                             ng-model="menu.parentMenuId" placeholder="请选择上级菜单"></div>
                    </div>
                </div>

                <div class="form-group" ng-show="showMenuType">
                    <label class="col-md-3 control-label">类别</label>

                    <div class="col-md-4">
                        <select class="form-control" ng-model="menu.menuType" name="menuType" required
                                ng-options="opt.value as opt.name for opt in options.menutype"></select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">url</label>

                    <div class="col-md-4">
                        <input type="text" class="form-control" ng-model="menu.menuUrl">
                    </div>
                </div>
                <div class="form-group" ng-show="menu.menuType==0">
                    <label class="col-md-3 control-label">Ctrl Path</label>

                    <div class="col-md-4">
                        <input type="text" class="form-control" ng-model="menu.ctrlPath">
                    </div>
                </div>
                <div class="form-group" ng-show="menu.menuType==0">
                    <label class="col-md-3 control-label">Icon</label>

                    <div class="col-md-4">
                        <input type="text" class="form-control" ng-model="menu.icon">
                    </div>
                </div>
                <div class="form-group" ng-show="menu.menuType!=null">
                    <label class="col-md-3 control-label">
                        <div ng-if="menu.menuType==0">Ctrl Name</div>
                        <div ng-if="menu.menuType==1">功能点id</div>
                    </label>

                    <div class="col-md-4" ng-show="menu.menuType!=null">
                        <input type="text" class="form-control" ng-model="menu.ctrlName">
                    </div>
                </div>
                <div class="form-group" ng-show="menu.menuType==0">
                    <label class="col-md-3 control-label">Template Url</label>

                    <div class="col-md-4">
                        <input type="text" class="form-control" ng-model="menu.templateUrl">
                    </div>
                </div>
                <div class="form-group" ng-show="menu.menuType==0">
                    <label class="col-md-3 control-label">排序</label>

                    <div class="col-md-4">
                        <input type="text" class="form-control" name="menuOrder" ng-model="menu.menuOrder" ed-validate="integer">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label">状态</label>

                    <div class="col-md-4">
                        <select class="form-control" ng-model="menu.menuState" name="menuState" required
                                ng-options="opt.value as opt.name for opt in options.menustate"></select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">描述</label>

                    <div class="col-md-4">
                        <textarea class="form-control" rows="3" ng-model="menu.remark"></textarea>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="col-md-offset-3 col-md-4">
                        <button type="button" class="btn green" w5c-form-submit="save()"><i class="fa fa-save"></i> 保存</button>
                        <button type="button" class="btn default" ng-click="cancel()"><i class="fa fa-times"></i> 取消
                        </button>
                    </div>
                </div>
            </div>
        </form>
        <!-- END FORM-->
    </div>
</div>
<!-- END MAIN CONTENT -->
<!-- BEGIN MAIN JS -->
<script>
</script>
<!-- END MAIN JS -->